/*
 * @Descripttion:
 * @version:
 * @Date: 2021-04-20 11:06:21
 * @LastEditors: huzhushan@126.com
 * @LastEditTime: 2021-04-21 09:36:55
 * @Author: huzhushan@126.com
 * @HomePage: https://huzhushan.gitee.io/vue3-element-admin
 * @Github: https://github.com/huzhushan/vue3-element-admin
 * @Donate: https://huzhushan.gitee.io/vue3-element-admin/donate/
 */
import request from '@/utils/request'

const base_Url = '/ztyh-funds-login/'
// 登录接口
export const Login = data => {
  return request({
    url: base_Url + 'ztyh/login/login',
    method: 'post',
    data,
  })
}

// 获取登录用户信息
export const GetUserinfo = () => {
  return request({
    url: base_Url + 'ztyh/login/getUserinfo',
    method: 'get',
  })
}
// 获取验证码
export const GetValidateCode = () => {
  return request({
    url: base_Url + 'ztyh/login/validateCode',
    method: 'get',
  })
}
// 获取手机验证码
export const getPhone = phone => {
  return request({
    url: base_Url + 'ztyh/login/send',
    method: 'get',
    params: {
      phone: phone,
    },
  })
}
// 手机验证码登录
export const getPhoneCode = data => {
  return request({
    url: base_Url + 'ztyh/login/phoneCode',
    method: 'post',
    data,
  })
}
// 用户名唯一验证
export const getUsernameOne = username => {
  return request({
    url: base_Url + 'ztyh/login/usernameOne',
    method: 'get',
    params: {
      username: username,
    },
  })
}
//忘记密码
export const updatePassword = data => {
  return request({
    url: base_Url + 'ztyh/login/forgetPassword',
    method: 'put',
    data,
  })
}
//手机号登录时判断是否已经存在
export const getPhoneOne = phone => {
  return request({
    url: base_Url + 'ztyh/login/phoneOne',
    method: 'get',
    params: {
      phone: phone,
    },
  })
}
//注册账号
export const register = data => {
  return request({
    url: base_Url + 'ztyh/login/register',
    method: 'post',
    data,
  })
}
//实名认证
export const GotoIdentity = data => {
  return request({
    url: base_Url + 'ztyh/login/GotoIdentity',
    method: 'post',
    data,
  })
}
//获取用户职业
export const Tocname = id => {
  return request({
    url: base_Url + 'ztyh/login/Tocname/' + id,
    method: 'get',
  })
}
//用户余额加
export const addMoney = data => {
  return request({
    url: base_Url + 'ztyh/login/addMoney',
    method: 'post',
    data,
  })
}
//查询余额
export const getMyunNum = id => {
  return request({
    url: base_Url + 'ztyh/login/getMyunNum/' + id,
    method: 'get',
  })
}

export const bankCard = (banalce, cardnumber) => {
  return request({
    url: base_Url + 'ztyh/login/banalceNumber',
    method: 'put',
    params: {
      banalce: banalce,
      cardnumber: cardnumber,
    },
  })
}
// Long moneyOut, Long moneyIn, BigDecimal amount, Integer operatorType
export const addCard = (data) => {
  return request({
    url: base_Url + 'ztyh/login/cardinfo',
    method: 'post',
    data,
  })
}
export const showCardBalance = cardnumber => {
  return request({
    url: base_Url + 'ztyh/login/showCardBalance',
    method: 'get',
    params: {
      cardnumber: cardnumber
    }
  })
}
export const listCardType = () => {
  return request({
    url: base_Url + 'ztyh/user/card/getlist',
    method: 'get',
  })
}
export const passwordUn = (id,password) =>{
  return request({
    url: base_Url + 'ztyh/login/passwordUn',
    method: 'get',
    params: {
      id: id,
      password: password,
    },
  })
}

export const outCard = (banalce, cardnumber) => {
  return request({
    url: base_Url + 'ztyh/login/outCard',
    method: 'put',
    params: {
      banalce: banalce,
      cardnumber: cardnumber,
    }
  })
}
export const getPhoneUsersname = (realname, phone) =>{
  return request({
    url: base_Url + 'ztyh/login/getPhoneUsersname',
    method: 'get',
    params: {
      realname: realname,
      phone: phone,
    },
  })
}

export const addMoneys = (phone,amount) =>{
  return request({
    url: base_Url + 'ztyh/login/addMoneys',
    method: 'put',
    params: {
      phone: phone,
      amount: amount,
    },
  })
}

export const GetUserListTime = (userId,openType) =>{
  return request({
    url: base_Url + 'ztyh/login/GetUserListTime',
    method: 'get',
    params: {
      openType: openType,
      userId: userId,
    },
  })
}
